<?php

use App\Http\Common\MyUtils;
use Illuminate\Support\Facades\DB;

if (!function_exists('getConfig')) {
    /**
     * 获得配置
     * 后期要查询数据库 config 数据库
     */
    function getConfig($str,$type="wy",$columnName = '',$columValue='') {
//        if ($columnName){
//            $res = DB::table($type."_config")->where("name",$str)
//                ->where($columnName,$columValue)
//                ->get("content")->first();
//        }else{
//            $res = DB::table($type."_config")->where("name",$str)
//                ->get("content")->first();
//        }
        $res = [];
        return trim(MyUtils::sg($res,'content'));
    }
}
if (!function_exists('getallheaders')) {
    /**
     * 新增 getallheaders 解决 php的getallheaders函数在nginx下失效
     */
    function getallheaders() {
        foreach ($_SERVER as $name => $value) {
            if (substr($name, 0, 5) == 'HTTP_') {
                $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
            }
        }
        return $headers;
    }

}
